home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / utilities / boot / shadowstart12.lha / ShadowStart12 / 2.0+ / ShadowStart.c next >
Encoding:
C/C++ Source or Header  |  1994-12-10  |  4.9 KB  |  140 lines

  1. /* $Revision Header built automatically *************** (do not edit) ************
  2. **
  3. ** © Copyright by Lars Eilebrecht (Shadowfox)
  4. **
  5. ** File             : Work:Program/SC/PRG/ShadowStart/ShadowStart.c
  6. ** Created on       : Mittwoch, 16.11.94 17:23:09
  7. ** Created by       : Lars Eilebrecht
  8. ** Current revision : V1.2
  9. **
  10. **
  11. ** Purpose
  12. ** -------
  13. **     Disable "WBStartup" and/or "User-Startup" during startup. (V37)
  14. **
  15. ** Revision V1.2
  16. ** --------------
  17. ** created on Freitag, 09.12.94 01:05:03  by  Lars Eilebrecht.   LogMessage :
  18. **   - rewrote ShadowStart for use with Kick/WB 2.0+
  19. **     (Activation-keys are now left or right alt)
  20. **     minor code changes
  21. **
  22. ** Revision V1.1
  23. ** --------------
  24. ** created on Montag, 28.11.94 18:58:55  by  Lars Eilebrecht.   LogMessage :
  25. **  -*-  changed on Samstag, 03.12.94 22:12:20  by  Lars Eilebrecht.   LogMessage :
  26. **   - recompiled ShadowStart without startup-code
  27. **     (results in a shorter executable)
  28. **  -*-  created on Montag, 28.11.94 18:58:55  by  Lars Eilebrecht.   LogMessage :
  29. **   - added NewShell-button
  30. **     renamed other buttons, so that it fit on a lores-screen
  31. **     removed stdio.h include (shorter executable)
  32. **     cleaned up code a little
  33. **
  34. ** Revision V1.0
  35. ** --------------
  36. ** created on Mittwoch, 16.11.94 17:23:09  by  Lars Eilebrecht.   LogMessage :
  37. **     --- Initial release ---
  38. **
  39. *********************************************************************************/
  40. #define REVISION "1.2"
  41. #define REVDATE  "09.12.94"
  42. #define REVTIME  "01:05:03"
  43. #define AUTHOR   "Lars Eilebrecht"
  44. #define VERNUM   1
  45. #define REVNUM   2
  46. #define TITLE "ShadowStart "REVISION" ("REVDATE") (V37) © by "AUTHOR" (Shadowfox)"
  47.  
  48. #include <exec/types.h>
  49. #include <intuition/intuition.h>
  50. #include <libraries/dos.h>
  51. #include <devices/inputevent.h>
  52.  
  53. #include <pragmas/exec_pragmas.h>
  54. #include <pragmas/dos_pragmas.h>
  55. #include <pragmas/intuition_pragmas.h>
  56. #include <pragmas/input_pragmas.h>
  57.  
  58. #include <clib/exec_protos.h>
  59. #include <clib/dos_protos.h>
  60. #include <clib/intuition_protos.h>
  61. #include <clib/input_protos.h>
  62. #include <clib/alib_protos.h>
  63.  
  64. static const char *ver ="$VER: "TITLE"\0";
  65.  
  66. int ShadowStart(void)
  67. {
  68.   LONG rc=RETURN_FAIL;
  69.  
  70.   struct Library *DOSBase;
  71.  
  72.   if(DOSBase=OpenLibrary("dos.library",37))
  73.   {
  74.     struct Library *IntuitionBase;   
  75.  
  76.     if(IntuitionBase=OpenLibrary("intuition.library",37))
  77.     {
  78.       struct MsgPort    *MsgPort;
  79.       struct IOStdReq   *InputReq;
  80.       struct Library    *InputBase;
  81.        
  82.       if(MsgPort=CreateMsgPort())
  83.       {                                                         // create MsgPort and open input.device
  84.         if(InputReq=CreateStdIO(MsgPort))
  85.         {
  86.           if(!OpenDevice("input.device",0,(struct IORequest *)InputReq,0))
  87.           {
  88.             rc=RETURN_OK;
  89.  
  90.             if(Rename("SYS:_WBStartup","SYS:WBStartup"))        // rename to original names...
  91.               Rename("SYS:_WBStartup.info","SYS:WBStartup.info");
  92.             Rename("SYS:S/_User-Startup","SYS:S/User-Startup");
  93.  
  94.             InputBase=(struct Library *)InputReq->io_Device;
  95.             if(PeekQualifier()&IEQUALIFIER_LALT||PeekQualifier()&IEQUALIFIER_RALT)
  96.             {                                                   // check for pressed alt-keys
  97.               LONG result;
  98.  
  99.               struct EasyStruct shadowES =                      // declare EasyRequest-struct
  100.                                 {
  101.                                   sizeof(struct EasyStruct),
  102.                                   0, // no flags
  103.                                   "ShadowStart "REVISION" ("REVDATE") © by Lars `SFX' Eilebrecht",
  104.                                   "\nSelect startup-items that should be disabled\n\nor select `NewShell' to open a shell-window\n",
  105.                                   "WB + User|WB|User|NewShell|Cancel",
  106.                                 };
  107.  
  108.               result=EasyRequest(NULL,&shadowES,NULL);
  109.               switch (result)
  110.               {                 // note: success of rename-operation isn't checked...
  111.                 case 1: 
  112.                   Rename("SYS:S/User-Startup","SYS:S/_User-Startup");
  113.                 case 2:
  114.                   Rename("SYS:WBStartup","SYS:_WBStartup");
  115.                   Rename("SYS:WBStartup.info","SYS:_WBStartup.info");
  116.                   break;
  117.                 case 3:
  118.                   Rename("SYS:S/User-Startup","SYS:S/_User-Startup");
  119.                   break;
  120.                 case 4:
  121.                  if(!Execute("NewShell",0,0))                   // open a shell-window...
  122.                    rc=RETURN_FAIL;
  123.                  Wait(SIGBREAKF_CTRL_C);                        // 'hold' startup-sequence...
  124.               }
  125.             }
  126.             CloseDevice((struct IORequest *)InputReq);
  127.           }
  128.           DeleteStdIO(InputReq);
  129.         }
  130.         DeleteMsgPort(MsgPort);
  131.       }
  132.       CloseLibrary(IntuitionBase);
  133.     }
  134.     else
  135.       PrintFault(ERROR_INVALID_RESIDENT_LIBRARY,"intuition.library");
  136.     CloseLibrary(DOSBase);
  137.   }
  138.   return(rc);
  139. }
  140.